'''
Company: TWL
Author: xue jian
Email: xuejian@kanzhun.com
Date: 2020-11-06 14:39:53
'''
#
# @lc app=leetcode.cn id=1557 lang=python3
#
# [1557] 可以到达所有点的最少点数目
#

# @lc code=start
from typing import List
class Solution:
    def findSmallestSetOfVertices(self, n: int, edges: List[List[int]]) -> List[int]:
        store = set()
        for _, to in edges:
            store.add(to)
        ans = []
        for i in range(n):
            if i not in store:
                ans.append(i)
        return ans
# @lc code=end

